<?php
  ob_start();
  session_start();

  $config = getenv('config');
  include_once("config/$config/conf.php");
  require_once('auth.php');

  if (!checkLoggedin($loginUrl)) {
    header('Location: login.php');
    return;
  }

  include_once('getConfig.php');
?>
<html>
  <head>
    <title><?php echo $title?></title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <link rel="stylesheet" type="text/css" href="./js/ext-3.3.0/resources/css/ext-all.css"/>
    <link rel="stylesheet" type="text/css" href="./js/ext-3.3.0/resources/css/vrTabPanel.css"/>
    <link rel="stylesheet" type="text/css" href="style.css?v=0.2"/>
  </head>
  <body onload="Ext.onReady(function(){init()})">
    <div id="loading-mask"></div>
    <div id="loading">
      <span id="loading-message">Loading core API. Please wait...</span>
    </div>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="./js/ext-3.3.0/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="./js/ext-3.3.0/ext-all.js"></script>
    <script type="text/javascript" src="./js/ext-3.3.0/vrTabPanel.js"></script>
    <script type="text/javascript" src="./js/OpenLayers-2.11-rc2/OpenLayers-closure.js"></script>
    <script>
      var center = '<?php echo $mapCenter?>'.split(',');
      var zoom   = '<?php echo $mapZoom?>';
      var defaultBasemap = '<?php echo $defaultBasemap?>';
      var banner = {
         height : '<?php echo $bannerHeight?>'
        ,body   : '<?php echo $bannerBody?>'
      };
      var config = <?php echo json_encode($configuration)?>;
    </script>
    <script type="text/javascript" src="map.js?v=0.2"></script>
  </body>
</html>
